<?  if ( ! defined('BASEPATH')) exit('No direct script access allowed'); 
/*
 CI Library Settings to retreive settings from DB
 Uses database library so must have valid database records in /system/application/config/database.php
 Written by: Ciprian Dimofte - 05-01-2010
 */
class Settings{
    public $CI;
    
    public function __construct(){
        $this->CI =& get_instance();
    }
    
    public function get_param($param_name){
        $param_value_sel = $this->CI->db->query("SELECT setting_value FROM settings WHERE setting_name = ?" , array($param_name));
        $param_value = $param_value_sel->row();
        return $param_value->setting_value;
    }
    
    public function set_param($param_name, $param_value){
        $param_value_sel = $this->CI->db->query("UPDATE settings SET param_value = '" . $this->CI->db->escape($param_value) . "' WHERE setting_name = " . $this->CI->db->escape($param_name));
        return TRUE;
    }
}

?>